﻿@model IEnumerable<E_Learning_V3.Models.Emne>
@{
    ViewBag.Title = "E-Learning Emner";
}
<h2>
    Vælg et emne for at begynde</h2>
@using (Html.BeginForm())
{
    @Html.DropDownList("emner", new SelectList(Model.Select(model => model.emnenavn)), new { onclick = "run()" })
    <input value="Vælg" type="submit" />    <div id="SubjectInfo">
    </div>
}
@{string message = ""; }
@{string[] lol = ViewBag.SvaretList; }
@for (int i = 0; i < lol.Count(); i++)
{
    message += "array[" + i + "]=\"" + lol[i] + "\";\n";
}
<div id="temp">
</div>

<script type="text/javascript">
    var array = new Array();   
@MvcHtmlString.Create(message)
    run();

    function run() {
        var choisen = document.forms[0]["emner"].selectedIndex;
        document.getElementById("SubjectInfo").innerHTML = array[choisen];
           }
</script>
